package com.itcast.demoone.kotlin

data class Student(
    val id: Int,
    var name: String,
    var age: Int,
    var sex: String = "男"
)

fun main(){
    // 自动生成：equals() / hashCode() / toString() / copy() / componentN()等方法
    val stu1 = Student(1, "张三", 18)
    val stu2 = Student(2, "李四", 28, "女")

    // toString()
    // println(stu1)
    // println(stu2)

    // equals()
    /*println(stu1 == stu2)
    val stu3 = Student(1, "张三", 18)
    println(stu1 == stu3)*/

    // copy()
    // val stu3 = stu1.copy()
    // val stu3 = stu1.copy(id = 3, name = "赵六", height = 180)
    // println(stu3)

    // componentN()
    // stu1.age
    val (id, name, age, sex) = stu1
    println("id: $id, name: $name, age: $age, sex: $sex")
}